package org.baicaixiaozhan.springbootwebdemo2.service;

import lombok.AllArgsConstructor;
import org.baicaixiaozhan.springbootwebdemo2.Dao.UserDao;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

/**
 * DESC:
 *
 * @author : baicaixiaozhan
 * @since : 2021-02-06
 */
@Service
@AllArgsConstructor
public class ApplicationUserServiceImpl implements UserDetailsService {

    private final UserDao userDao;

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return userDao.findUserByUsername(username);
    }
}
